import type { postForm } from "@/api/post";
import { defineStore } from "pinia";
import { reactive, ref } from "vue";

export const usePostStore = defineStore("post", {
  state: () => {
    return {
      posts: reactive<postForm[]>([]),
    };
  },
  actions: {
    setPosts(newposts: postForm[]) {
      this.posts = newposts;
    },

    removeData() {
      this.posts = <postForm[]>[];
    },
  },
  persist: true,
});
